package com.card.hwatt.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 员工
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "KQZ_Employee")
public class Employee {

	@Id
	@GeneratedValue(generator = "generator", strategy = GenerationType.AUTO)
	@GenericGenerator(name = "generator", strategy = "native")
	@Column(name = "EmployeeID")
	public Long id;

	/**
	 * 编号
	 */
	@Column(name = "EmployeeCode", length = 16, nullable = false)
	public String employeeCode;

	/**
	 * 姓名
	 */
	@Column(name = "EmployeeName", length = 250, nullable = true)
	public String name;

	@Column(name = "Birthday")
	public Date birthday;

	/**
	 * 部门
	 */
	@ManyToOne(cascade = {}, fetch = FetchType.EAGER)
	@JoinColumn(name = "BrchID", nullable = false)
	public Department department;
	
	/**
	 * 维保单位人员
	 */
	@OneToOne(cascade = { CascadeType.ALL, CascadeType.REMOVE }, mappedBy = "employee")
	@JoinColumn(nullable = false)
	public User user;
}
